// 合力售后宝项目前缀
const PREFIX_HELI = '/api'

// 其他项目前缀
const PREFIX_OTHER = '/HMP_003/api'

// 获取维修工所在组织的全部维修经理
export const getRepairManagers = params => {
	return uni.$u.http.get(`${ PREFIX_OTHER }/GetRepairManagerList`, { params })
}

// 根据车号扫码获取相关信息
export const getCartInfo = (data, token, location) => {
	return uni.$u.http.get(`${ PREFIX_HELI }/Customer/GetCustomerByVehicle?vehicleNumber=${ data }&token=${ token }&location=${ location }`)
}

// 根据车号扫码获取相关信息(车辆配置信息、关键零部件号)
export const getCartData = (data, token, location) => {
	return uni.$u.http.post(`${ PREFIX_HELI }/SAPCall?token=${ token }&location=${ location }`, data)
}

// 新增（申请任务）
export const addTask = (data, token, location) => {
	return uni.$u.http.post(`${ PREFIX_OTHER }/CreateRepairTaskOnSite?token=${ token }&location=${ location }`, data)
}

// 新增 - 申请任务 - 保存到草稿
export const saveToDraft = (data, token, location) => {
	return uni.$u.http.post(`${ PREFIX_OTHER }/SaveRepairTaskTemp?token=${ token }&location=${ location }`, data)
}

// 新增 - 申请任务 - 获取草稿信息
export const getDraftInfos = (params) => {
	return uni.$u.http.get(`${ PREFIX_OTHER }/GetTempRepairOrderByUserName`, { params })
}

// 现场维修单详情 - 查询任务信息
export const getTaskInfo = (params) => {
	return uni.$u.http.get(`${ PREFIX_OTHER }/GetRepairTaskById`, { params })
}

// 现场维修单详情 - 已驳回 - 查询任务详情
export const getTaskDetails = (params) => {
	return uni.$u.http.get(`${ PREFIX_OTHER }/GetRepairOrderById`, { params })
}

// 现场维修单详情 - 维修详情
export const getRepairInfo = (params) => {
	return uni.$u.http.get(`${ PREFIX_OTHER }/GetOnSiteRepairOrderById`, { params })
}

// 现场维修 - 待维修 - 维修详情 - 待工、转单、审核
export const waitingWork = (data, token, location) => {
	return uni.$u.http.post(`${ PREFIX_OTHER }/RepairOnSite?token=${ token }&location=${ location }`, data)
}

// 现场维修 - 已驳回 - 保存（编辑）
export const eidtRepairOrder = (data, token, location) => {
	return uni.$u.http.post(`${ PREFIX_OTHER }/ApplyRepairOrder?token=${ token }&location=${ location }`, data)
}

// 查询故障件列表中附件信息
export const getAttachmentInfo = (params) => {
	return uni.$u.http.get(`${ PREFIX_HELI }/GetAttachmentListByFKId`, { params })
}

// 保存故障件条码
export const saveBarcodeList = (data, token, location) => {
	return uni.$u.http.post(`${ PREFIX_OTHER }/SaveMaterialTrace?token=${ token }&location=${ location }`, data)
}

// 查询故障件条码列表
export const getBarcodeList = (params) => {
	return uni.$u.http.get(`${ PREFIX_HELI }/`, { params })
}

